/**
 * Created by Administrator on 2017/1/9.
 */
$(function () {
    $('#start_datetime').datetimepicker({
        language:  'zh-CN',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        showMeridian: 1
    });

    $('#end_datetime').datetimepicker({
        language:  'zh-CN',
        weekStart: 1,
        todayBtn:  1,
        autoclose: 1,
        todayHighlight: 1,
        startView: 2,
        forceParse: 0,
        showMeridian: 1
    });
});
function init(){
    var checkText= $("[name='type']").find("option:selected").text();

    if (checkText == '公司') {
        $('#group_containers').show();
        $('#company_name_analyst_1').attr("name",'company_name_analyst_1');
        $('#operate_analyst_1').attr("name",'operate_analyst_1');
    }else{
        $('#group_containers').hide();
        $('#company_name_analyst_1').removeAttr("name");
        $('#operate_analyst_1').removeAttr("name");

        $('#company_name_analyst_2').removeAttr("name");
        $('#operate_analyst_2').removeAttr("name");

        $('#company_name_analyst_3').removeAttr("name");
        $('#operate_analyst_3').removeAttr("name");
    }
}
$(function () {console.log(1111)
    var morningconferencetype = $("[name='type']");
    init();
    morningconferencetype.on('change', function () {
        init();
    })
});

$(function () {
    var $range = $("[name='money_type']");
    $range.on('change', function () {
        $('#type_money_company').val($range.filter(':checked').val());
    })
});

$(function () {
    var $range = $("[id='plus_1']");
    $range.on('click', function () {
        $('#group_container_2').show();
        $('#plus_1').hide();

        $('#company_name_analyst_2').attr("name",'company_name_analyst_2');
        $('#operate_analyst_2').attr("name",'operate_analyst_2');
    })
});

$(function () {
    var $range = $("[id='plus_2']");
    $range.on('click', function () {
        $('#group_container_3').show();
        $('#plus_2').hide();
        $('#minus_1').hide();

        $('#company_name_analyst_3').attr("name",'company_name_analyst_3');
        $('#operate_analyst_3').attr("name",'operate_analyst_3');
    })
});

$(function () {
    var $range = $("[id='minus_1']");
    $range.on('click', function () {
        $('#group_container_2').hide();
        $('#plus_1').show();

        $('#company_name_analyst_2').removeAttr("name");
        $('#operate_analyst_2').removeAttr("name");
    })
});
$(function () {
    var $range = $("[id='minus_2']");
    $range.on('click', function () {
        $('#group_container_3').hide();
        $('#plus_2').show();
        $('#minus_1').show();

        $('#company_name_analyst_3').removeAttr("name");
        $('#operate_analyst_3').removeAttr("name");
    })
});

